CREATE TABLE [dbo].[DnnProduct_ScheduleHistory]
(
[ScheduleHistoryID] [int] NOT NULL IDENTITY(1, 1),
[ScheduleID] [int] NOT NULL,
[StartDate] [datetime] NOT NULL,
[EndDate] [datetime] NULL,
[Succeeded] [bit] NULL,
[LogNotes] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[NextStart] [datetime] NULL,
[Server] [nvarchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_ScheduleHistory] ADD CONSTRAINT [PK_DnnProduct_ScheduleHistory] PRIMARY KEY CLUSTERED  ([ScheduleHistoryID]) WITH (FILLFACTOR=85) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DnnProduct_ScheduleHistory_NextStart] ON [dbo].[DnnProduct_ScheduleHistory] ([ScheduleID], [NextStart] DESC) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DnnProduct_ScheduleHistory_StartDate] ON [dbo].[DnnProduct_ScheduleHistory] ([ScheduleID], [StartDate] DESC) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_ScheduleHistory] WITH NOCHECK ADD CONSTRAINT [FK_DnnProduct_ScheduleHistory_DnnProduct_Schedule] FOREIGN KEY ([ScheduleID]) REFERENCES [dbo].[DnnProduct_Schedule] ([ScheduleID]) ON DELETE CASCADE NOT FOR REPLICATION
GO
